﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace P2PLib.Client.DataModel
{
    /// <summary>
    /// 写属性
    /// </summary>
    [Serializable]
    public class DownloadTask
    {
        private CFileInfo file;
        private long completedSize;
        private DownloadStatus status;
        private DateTime startedTime;
        private string localDir;

        #region constructor

        public DownloadTask()
        {

        }

        public DownloadTask(CFileInfo file,string dir)
        {
            this.file = file;
            this.startedTime = DateTime.Now;
            this.completedSize = 0;
            this.status = DownloadStatus.Paused;
            this.localDir = dir;
            this.status = DownloadStatus.Stoped;
        }

        #endregion //constructor

        #region property
        public CFileInfo File
        {
            get
            {
                return file;
            }
            set
            {
                this.file = value;
            }
        }

        public long CompletedSize
        {
            get { return completedSize; }
            set
            {
                this.completedSize = value;
            }
        }

        public DateTime StartedTime
        {
            get { return this.startedTime; }
            set
            {
                this.startedTime = value;
            }
        }

        public DownloadStatus Status
        {
            get { return status; }
            set
            {
                this.status = value;
            }
        }

        /// <summary>
        /// 本地保存的文件夹;
        /// </summary>
        public string LocalDir
        {
            get
            {
                return this.localDir;
            }
            set
            {
                this.localDir = value;
            }
        }
        #endregion //property
    }


    public enum DownloadStatus
    {
        Downloading,
        
        Completed,

        Paused,

        Stoped,

        Connecting,

        Waiting
    }
}
